const app = getApp();
const baseUrl = app.globalData.baseUrl;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    traineePhone: null,
    elements: [{
      name: 'EMS评估',
      cover_s: baseUrl + '/file/ems.jpg'
    }, {
      name: '体测数据',
      cover_s: baseUrl + '/file/ticeyi3.png'
    }, {
      name: '身体围度',
      cover_s: baseUrl + '/file/weidu.jpg'
    }, {
      name: '体适能',
      cover_s: baseUrl + '/file/balance.jpeg'
    }, {
      name: '历史数据',
      cover_s: baseUrl + '/file/history3.jpg'
    }]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  toDetail: function (e) {
    const that = this;
    const index = e.currentTarget.dataset.index;
    switch (index) {
      case 0:
        that.toEMS();
        break;
      case 1:
        that.toBodyMeasurements();
        break;
      case 2:
        that.toBodyCircumference();
        break;
      case 3:
        that.toBodyAdaptability();
        break;
      case 4:
        that.toHistory();
        break;
    }
  },
  onLoad: function(options) {
    const traineePhone = wx.getStorageSync('traineePhone');
    this.setData({
      traineePhone
    });
  },
  toEMS: function() {
    wx.setStorageSync('traineePhone', this.data.traineePhone);
    wx.navigateTo({
      url: '/pages/emsEvaluation/emsEvaluation',
    });
  },
  toBodyMeasurements: function() {
    wx.setStorageSync('phone', this.data.traineePhone);
    wx.navigateTo({
      url: '/pages/xoneData/xoneData',
    });
  },
  toBodyCircumference: function() {
    wx.setStorageSync('traineePhone', this.data.traineePhone);
    wx.navigateTo({
      url: '/pages/bodyCircumference/bodyCircumference',
    });
  },
  toBodyAdaptability: function() {
    wx.setStorageSync('traineePhone', this.data.traineePhone);
    wx.navigateTo({
      url: '/pages/bodyAdaptability/bodyAdaptability',
    });
  },
  toHistory:function(){
    wx.setStorageSync('traineePhone', this.data.traineePhone);
    wx.navigateTo({
      url: '/pages/bodyDataHistory/bodyDataHistory',
    });
  }
})